import request from '@/utils/request'


/**
 * 查询所有分类
 * @returns 
 */
export function selectAllCategories() {
    return request({
        url: '/admin/category/list',
        method: 'get',
        
    })

}

/**
 * 查询分类信息
 * @param {*} params 
 * @returns 
 */
export function listCategories(params) {
    return request({
        url: '/admin/category/list',
        method: 'post',
        data: {
            pageNum: params.pageNum,
            limit: params.limit
        }
    })

}
/**
 * 删除分类
 * @param {*} categoryId 
 * @returns 
 */
export function deleteCategory(categoryId) {
    return request({
        url: '/admin/category/' + categoryId,
        method: 'delete'
    })
}
/**
 * 保存分类
 * @param {}} categoryName 
 * @returns 
 */
export function saveCategory(categoryName) {
    return request({
        url: '/admin/category/save',
        method: 'post',
        params: {
            categoryName: categoryName
        }
    })
}
/**
 * 获取
 * @param {*} categoryId 
 * @returns 
 */
export function getCategory(categoryId){
    return request({
        url:'/admin/category/'+categoryId,
        method:'get',

    })
}
/**
 * 修改
 * @param {*} params 
 * @returns 
 */
export function editCategory(params){
    return request({
        url:'/admin/category',
        method:'put',
        data:{
            categoryId:params.categoryId,
            categoryName:params.categoryName
        }
    })
}